shred (Unix)

Shred

Shred securely erasing a text file.

shred is a Unix command that can be used to securely delete files and devices so that they can be recovered only with great difficulty with specialised hardware, if at all.1 It is a part of GNU Core Utilities.

Contents

Background

For efficiency, erasing a file usually only erases the file system entry and keeps the content of the file intact. This frequently allows the file to be recovered using commonly available software. Even if the file is overwritten, residual magnetic fields may allow data recovery using specialist hardware equipment. To prevent this, shred overwrites the file multiple times using patterns chosen to maximize destruction of the residual data. The articles data erasure and data remanence have additional information.

Features

shred can be invoked either on ordinary files or on devices (such as hard disk partitions), which are represented as files in Unix. By default, shred overwrites the file 25 times with multiple patterns, but the number is user configurable. Shred has an option to do an additional final overwrite with zeroes, which may help to hide the fact that shred was used.

By default, shred also shreds file slack (unused space in file allocations). For example, a 5 KB file on a file system with 4 KB clusters actually requires 8 KB of storage. Shred has an option to overwrite only the file itself, as well as an option to delete the file after it has completed operation.

Limitations

A limitation of shred is that it only overwrites the data in place without overwriting other copies of the file. Copies can manifest themselves in a variety of ways, such as through manual and automatic backups, file system snapshots, copy-on-write filesystems, wear leveling on flash drives, caching such as NFS caching, and journaling. Some of these limitations can be overcome by shredding the entire device instead of specific files.

See also

References

Notes

1.^ The data remanence article provides citations to publications that investigate the security of shredding.